<%-- 
    Document   : dato
    Created on : 7/09/2014, 05:08:35 PM
    Author     : Jorge
--%>



<%@page import="java.sql.ResultSet"%>

<jsp:useBean id="cls" class="metodo.ap" scope="page"></jsp:useBean>

<%
    String user = request.getParameter("nombre");
    String passw = request.getParameter("password");
    try {
        ResultSet rs = cls.consulta(user, passw);
        if (!rs.next()) {
            out.print("[");
            do {
                out.print("{");
                out.print("\"Estado\"");
                out.print(":");
                out.print("\"No\"");
                out.print("}");
                out.print("]");
            } while (rs.next());
        } else {
            String pass = rs.getString(3);
            if (passw.equals(pass)) {
                out.print("[");
                do {
                    out.print("{");
                    out.print("\"Estado\"");
                    out.print(":");
                    out.print("\"Si\"");
                    out.print("}");
                    out.print("]");
                } while (rs.next());
            }
        }
    } catch (Exception e) {
        out.print("Error al consultar: " + e);
    }
%>
